<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<jsp:include page="/WEB-INF/views/layouts/head.jsp"></jsp:include>
<html>
<head>
<title>接送机</title>
<link href="${ctxStatic }/cityselector/cityselect.css" rel='stylesheet'type='text/css' />
<link href="${ctxStatic }/index/css/transfer.css" rel="stylesheet">
<link href="${ctxStatic }/xiake/css/list.css" rel='stylesheet'type='text/css' />
<link href="${ctxStatic }/index/css/style.css" rel='stylesheet'type='text/css' />
<link rel="stylesheet" href="${ctxStatic }/index/css/daycars2.css" />
<script src="${ctxStatic }/index/transfer/js/transfer.js"></script>
<script type="text/javascript">
	$(function() {
		//showCityInfo();
		$('.tstyle').click(function(){
			$("#tsy").val($(this).attr("value"));
			$("#pageNo").val(1);
			$("#pageSize").val(5);
			$('#airportRentForm').submit();
		});
		var keyVal2 = "${sessionScope.mes}";
		if(keyVal2.length!=0){  
			alert(keyVal2);
			/* window.location.href = '${ctxFront }/indexAirRent'; */
		}
		// 机场
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'9'}, function(data) {
			new Vcity.CitySelector({input:'departcity_sitename3',cityData:data});
		});
		// 送达城市
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'0'}, function(data) {
			new Vcity.CitySelector({input:'destcity_sitename3',cityData:data});
		});
		$('.airportRentTab').click(function(){
			$('#airportRentType').val($(this).attr('data-value'));
			changeShowSpan($(this).attr('data-value'));
		});
	})
function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#airportRentForm").submit();
		return false;
	}
	function changeShowSpan(val){
		if(val=='接机') {
			var span = $('.airportDestcitySpan');
			$(span[0]).text('出发机场：');
			$(span[1]).text('抵达城市：');
		} 
		if(val=='送机') {
			var span = $('.airportDestcitySpan');
			$(span[0]).text('抵达机场：');
			$(span[1]).text('出发城市：');
		}
}
	function showCityInfo() {
		var myCity = new BMap.LocalCity();
		myCity.get(myFun);
		//定位ip
		var cityinfo = '';
		var map = new BMap.Map("allmap");
		function myFun(result) {
			var cityName = result.name;
			cityinfo = cityName;
			$("#cityinfo").html(cityinfo);
			//setCity(cityinfo);
		}
		function setCity(obj){
			$.post('${ctxFront}/json/getSiteidByName', {
				name : obj
			}, function(data) {
				// 定位城市选中
				var $autocity = $('input[data-autocity="yes"]');
				$autocity.val(cityinfo);
				$autocity.next('input').val(data.siteid);
			});
		}
	}
</script>
</head>
<%
session.removeAttribute("mes");
	%>
<body><input type="hidden" id="menuInfo" value="indexAirRent">
	<div class="meet">
	<p id="distance" style="color: red;padding:20px 0;font-size: 12px;" name="distance">注：&nbsp;${tRentproduct.remarks }</p>
<div class="container">

<form id="airportRentForm" action="${ctxFront}/rentproduct/airlist" method="post">
<input type="hidden" name="rentType" value="${ORDER_TYPE_RENTPRODUCT_AIRPLANE }"/>
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<input type="hidden" name="mapkm" value="${tRentproduct.mapkm }" id="mapkm"/>
<input type="hidden" name="maptime" value="${tRentproduct.maptime }" id="maptime"/>
<input type="hidden" name="mes" value="${tRentproduct.remarks }" id="mes"/>
<input type="hidden" name="tstyle" value="${tstyle }" id="tsy"/>
<input type="hidden" name="aboardAddress" value="${tRentproduct.aboardAddress }" id="aboardAddress"/>
<input id="airportRentType" type="hidden" name="tabType" value="接机"/>
    <ul class="tabs">
        <li class="airportRentTab " data-value="接机">接机</li>
        <li class="airportRentTab" data-value="送机">送机</li>
    </ul>

<dl class="dg_city">
    <dd>
        <span class="date_1 airportDestcitySpan">出发机场：</span>
		<input type="text" id="departcity_sitename3" class="display_ib flex_select1 date_3" name="departcity.sitename" 
		value="${tRentproduct.departcity.sitename }" placeholder="请选择机场" autocomplete="off">
		<input type="hidden" name="departcity.siteid" value="${tRentproduct.departcity.siteid }">
    </dd>
    <dd>
        <span class="arrival airportDestcitySpan">抵达城市：</span>
        <input type="text" id="destcity_sitename3" 
        class="display_ib flex_select1 addss" name="destcity.sitename"
         value="${tRentproduct.destcity.sitename }" style="padding-left: 10px;width: 120px;" placeholder="请输入" autocomplete="off">
		<input type="hidden" name="destcity.siteid"  id="destcity.siteid" value="${tRentproduct.destcity.siteid }">
		
		<input type="text"  id="suggestId" value="${tRentproduct.aboardAddress }"
	placeholder="${tRentproduct.aboardAddress }"	 name="aboardAddress" class="addss" style="padding-left: 10px;width: 150px"/>
<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
    </dd>
    <dd>
        <span class="arrival">出发时间：</span>
       <!--  <span id="demospan" style="display: none"></span> -->
        <input type="text" name="fromdateStr" readonly class="display_ib flex_input_ty1 Wdate date_3" value="${tRentproduct.fromdateStr }"
		onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,maxDate:'${maxDay }',minDate:'${today}'});" style="width: 120px;height: 30px"/>
	<input type="text" name="time" readonly class="display_ib flex_input_th1 Wdate dg_time" value="${tRentproduct.time }"
		onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});" style="width: 120px;height: 30px"/>
        <input class="inquiry" type="button" value="查询" id="airportsearch">
    </dd>
</dl>
</form>
            </div>
               <div class="car-box">
                <p style="padding-bottom: 10px;border-bottom: 1px dashed #cdcdcd;">选择车型：</p>
                <ul class="car-list" style="margin-bottom: 30px;">
				<li class="car-il car-title">
					<a  class="tstyle" value="" href="javascript:;">
						<i class="iconfont" style="color: #00b388;font-size: 38px;line-height: 50px;">&#xe61d;</i>
						<span class="m-txt car-tgreen" >不限</span>
					</a>
							</li>
							<li class="car-il">
								<a  class="tstyle" value="swc">
									<i class="iconfont ico_c" <c:if test="${tstyle=='swc' }">style="color: #00b388;font-size: 50px;line-height: 50px;"</c:if>>&#xe66c;</i>
									<span class="m-txt <c:if test="${tstyle=='swc' }">car-tgreen</c:if>">6座商务车</span>
								</a>
							</li>
							<li class="car-il">
								<a  class="tstyle" value="xb">
								   <i class="iconfont ico_c"  <c:if test="${tstyle=='xb' }">style="color: #00b388;font-size: 50px;line-height: 50px;"</c:if>>&#xe607;</i>
									<span class="m-txt <c:if test="${tstyle=='xb' }">car-tgreen</c:if>">14座以下小巴</span>
								</a>
							</li>
							<li class="car-il">
								<a  class="tstyle" value="zb">
									<i class="iconfont ico_c" <c:if test="${tstyle=='zb' }">style="color: #00b388;font-size: 50px;line-height: 50px;"</c:if>>&#xe61b;</i>
									<span class="m-txt <c:if test="${tstyle=='zb' }">car-tgreen</c:if>">24座以下中巴</span>
								</a>
							</li>
							<li class="car-il">
								<a  class="tstyle" value="db">
									<i class="iconfont ico_c" <c:if test="${tstyle=='db' }">style="color: #00b388;font-size: 50px;line-height: 50px;"</c:if>>&#xe665;</i>
									<span class="m-txt <c:if test="${tstyle=='db' }">car-tgreen</c:if>" >25座以上大巴</span>
								</a>
							</li>
						</ul>
                </div>
            <div class="box">
            <c:if test="${not empty cargotypeList }">
<c:forEach items="${page.list }" var="index">
                <div class="carday_vs">
                    <div class="carf_list">
                        <div class="carf_oi">
                            <div class="carg_i">
                                <div class="carg_l_img">
                                    <img src="${index.cargotype.images }" />
                                </div>
                                <div class="carg_r_ex">
                                    <div class="carg_nm">
                                        <p>
                                            <span>${index.cargotype.typename }</span>
                                            <span>
               	    	 	 	   	   	   	    <i class="cig-ico01"></i>
               	    	 	 	   	   	   	    <b>载客${index.cargotype.seats }人</b>
               	    	 	 	   	   	   </span>
                                            <span>
               	    	 	 	   	   	   	    <i class="cig-ico02"></i>
               	    	 	 	   	   	   	    <b>行李${index.cargotype.packs }件</b>
               	    	 	 	   	   	   </span>
                                        </p>
                                        <p>${index.cargotype.typedesc }</p>
                                    </div>
                                </div>
                                <div class="carg_kl">
                                    <p>
   ￥<fmt:formatNumber type="number" value="${index.lowestAirPrice}" pattern="0" maxFractionDigits="0"/>起</p>
                                    <p>共报价&nbsp;<b>${fn:length(index.officeList)}</b>&nbsp;个</p>
                                </div>
                            </div>
                            <div class="caro_li">
                                <div class="caro_ik_tit">
                                    <span>车队</span>
                                    <span>特色服务</span>
                                    <span>价格</span>
                                    <span>操作</span>
                                </div>
                                <div class="caro_body">
                                    <c:if test="${fn:length(index.officeList)!=1}"><i class="caro_jia"></i></c:if>
                                    					<script>
		$(function(){
			    var hif=true;
			$('.caro_jia').click(function(){
				if(hif){
				$(this).css('background','url(${ctxStatic }/index/images/jian.png)');
								$(this).siblings('.hid_price').slideDown();
				hif=false;
				}else{
				$(this).css('background','url(${ctxStatic }/index/images/jia.png)');
				      $(this).siblings('.hid_price').slideUp();
				hif=true;
				}
			})
		     	hif!=hif;

		})
	</script>
                     <c:forEach items="${index.officeList }" var="office" varStatus="vs">               
                                    <div class="caro_ik <c:if test='${vs.index==0 }'>m_price</c:if> <c:if test='${vs.index!=0 }'>hid_price</c:if>">
                                        <span>${office.abbr }  </span>
                                        <span><c:if test="${office.iswifi == '1' }">无线wifi</c:if>
							<c:if test="${office.powersupply == '1' }">车载充电</c:if>
							<c:if test="${office.tablewater == '1' }">免费饮用水</c:if>
							<c:if test="${office.businesssuit == '1' }">商务正装</c:if>
							<c:if test="${office.paper == '1' }">免费纸巾</c:if> </span>
                                        <span>
                 ￥<fmt:formatNumber type="number" value="${office.airPrice }" pattern="0" maxFractionDigits="0"/>                     
                                </span>
                                       
     <%-- <a class="dc-button" id="detail" href="javascript:window.location.href=
	'${ctxFront}/sms/airdetails?time=${tRentproduct.time }&departcity.sitename=${tRentproduct.departcity.sitename }
	&destcity.sitename=${tRentproduct.destcity.sitename }&productname=${tRentproduct.productname }&office.iswifi=${office.iswifi }
	&office.powersupply=${office.powersupply }&office.tablewater=${office.tablewater }
	&aboardAddress=${tRentproduct.aboardAddress }&cargotype.typedesc=${index.cargotype.typedesc }
	&office.businesssuit=${office.businesssuit }&office.paper=${office.paper }&office.abbr=${office.abbr }
	&tabType=${tRentproduct.tabType}&fromdateStr=${tRentproduct.fromdateStr }';" >预定</a> --%>
	<form action="${ctxFront}/sms/airdetails" method="post"> <span>
		<input type="hidden" name="time" value="${tRentproduct.time }" />
		<input type="hidden" name="departcity.sitename" value="${tRentproduct.departcity.sitename }" />
		<input type="hidden" name="destcity.sitename" value="${tRentproduct.destcity.sitename }" />
		<input type="hidden" name="productname" value="${tRentproduct.productname }" />
		<input type="hidden" name="office.name" value="${office.name }" />
		<input type="hidden" name="office.iswifi" value="${office.iswifi }" />
		<input type="hidden" name="office.powersupply" value="${office.powersupply }" />
		<input type="hidden" name="office.tablewater" value="${office.tablewater }" />
		<input type="hidden" name="aboardAddress" value="${tRentproduct.aboardAddress }" />
		<input type="hidden" name="cargotype.typedesc" value="${index.cargotype.typedesc }" />
		<input type="hidden" name="cargotype.typename" value="${index.cargotype.typename  }" />
		<input type="hidden" name="office.businesssuit" value="${office.businesssuit }" />
		<input type="hidden" name="office.paper" value="${office.paper }" />
		<input type="hidden" name="office.abbr" value="${office.abbr }" />
		<input type="hidden" name="cargotype.cargotypeid" value="${index.cargotype.cargotypeid }" />
		<input type="hidden" name="cargotype.images" value="${index.cargotype.images }" />
		<input type="hidden" name="tabType" value="${tRentproduct.tabType}" />
		<input type="hidden" name="fromdateStr" value="${tRentproduct.fromdateStr }" />
		<input type="hidden" name="office.airPrice" value="${office.airPrice }" />
		<input type="hidden" name="cargotype.outtimefee" value="${index.cargotype.outtimefee }" />
		<input type="submit" class="dc-button" value="预定"> </span>
	</form>
               	    	 	 	 	
                                    </div>
                      </c:forEach>              
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
         </c:forEach>  
          </c:if>
   <c:if test="${empty cargotypeList }">
		<div style="text-align: center;margin:20px;font-size:14px;color:#607D8B;">霞客君太懒，您要的产品还没有上架。您可以试试<a href="${ctxFront }/rentproduct/demands/form" style="color:#4FBDBA;">定制包车</a>哦~</div>
	</c:if>   
            </div>
        </div>
		<div style="text-align: center;margin-top: 50px;width: 100%;float: left;">
		<div class="pagination  font_normal_size" >${page.html}</div>
		</div>
</body>
<jsp:include page="/WEB-INF/views/layouts/foot.jsp"></jsp:include>
</html>
<%-- <jsp:include page="/WEB-INF/views/layouts/foot.jsp"></jsp:include>  --%>
<script type="text/javascript" src="${ctxStatic }/index/js/map.js"></script>
<script type="text/javascript">
//接送机提交
var km = 0;
var time = 0;
$(function(){
	$("#airportsearch").click(function(){
		if($('#departcity_sitename3').val()=="") {
			alert("机场不能为空");
			return false;
		}
		if($('#destcity_sitename3').val()=="") {
			alert("城市不能为空");
			return false;
		}
		if($('#suggestId').val()=="") {
			alert("请输入详细地址");
			return false;
		}
		var x= $('#suggestId').val();
		var y = $('#departcity_sitename3').val()
		var map = new BMap.Map("allmap");
var output = "从"+y+"到"+x+"驾车预计需要";
var searchComplete = function (results){
	if (transit.getStatus() != BMAP_STATUS_SUCCESS){
		return ;
	}
	var plan = results.getPlan(0);
	output += plan.getDuration(true) + "\n";                //获取时间
	time = plan.getDuration(true);
	$('#maptime').val(time)
	output += "总路程大约为：" ;
	output += plan.getDistance(true) + "\n";             //获取距离
	km = plan.getDistance(true);
	$('#mapkm').val(km);
}
var transit = new BMap.DrivingRoute(map, {renderOptions: {map: map},
	onSearchComplete: searchComplete,
	onPolylinesSet: function(){        
		$("#distance").html(output);
		$("#mes").val(output);
}});
transit.search(x, y);
window.setTimeout(submitform, 1000); 
function submitform() 
{ 
	$("#aboardAddress").val(x);
$('#airportRentForm').submit();
} 
})
	})
</script>